var argv = process.argv[2];
var fs = require('fs')
var path = require('path')

var delfilename = path.join(__dirname, `/${argv}`)


if (fs.statSync(delfilename).isFile()) {
    fs.unlinkSync(delfilename)
}
else {
    function delFile(delfilename) {
        if (!fs.existsSync(delfilename)) return;
        var files = fs.readdirSync(delfilename)

        for (var i = 0; i < files.length; i++) {
            if (fs.statSync(delfilename + '/' + files[i]).isFile()) {
                fs.unlinkSync(delfilename + '/' + files[i])
            }
            else {
                delFile(delfilename + '/' + files[i])
            }
        }
        fs.rmdirSync(delfilename)//删除空文件夹
    }
}

delFile(delfilename)




